<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" >
    <head lang="en">
        <title>Query Page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <script type="text/javascript" th:src="@{/lib/jquery-1.7.2.min.js}"/>
        <script src="//hm.baidu.com/hm.js?3cfaa114cca90dbeb8cf6908074f92ef"></script>

        <script type="text/javascript" th:inline="javascript">
            /*<![CDATA[*/
            var basePath = /*[[${#httpServletRequest.getScheme() + "://" + #httpServletRequest.getServerName() + ":" + #httpServletRequest.getServerPort() + #httpServletRequest.getContextPath()}]]*/;
            $(document).ready(function() {
                $("#search").click(function() {
                    console.info("do search.");
                    if($("#queryStr").val().trim() == "")
                        return;
                    $.getJSON(basePath+'/project/search.do?queryStr='+$("#queryStr").val(), function(result){
                        console.info(result);
                        if(result.hasOwnProperty('projects')){
                            $("#content").empty();
                            var tmpContent = "";
                            $.each(result.projects, function(index, p) {
                                console.info(p.key +"\t"+p.summary+"\t"+p.description+"\t"+p.scheme);
                                tmpContent +="<b>"+(index+1)+"th</b>&nbsp;&nbsp;&nbsp;&nbsp;" +
                                    "<b>"+p.key+"</b><br/>"+
                                    "<b>报告人:</b><span>"+p.reporter+"</span><br/>"+
                                    "<b>支持人:</b><span>"+p.supporter+"</span><br/>"+
                                    "<b>主题:</b><span>"+p.summary+"</span><br/>"+
                                    "<b>问题描述:</b><span>"+p.description+"</span><br/>" +
                                    "<b>解决方案:</b><span>"+p.scheme+"</span><br/><br/>"
                            });
                            $("#content").append(tmpContent);
                        }
                    });
                });
            });
            /*]]>*/
        </script>
    </head>
    <body>
        <div align="center">
            <input type="text" id="queryStr" placeholder="请输入检索内容"/><input id="search" type="button" value="搜索"/>
        </div>
        <div id="content"> </div>
    </body>
</html>